package com.songyz.image.compress.enums;

public enum Compress {

    NO_EXISTS(0, "文件不存在"), //
    WAIT(1, "待压缩"), //
    DOING(2, "压缩中"), //
    SUCCESS(3, "压缩完成"),//
    ;

    private int code;
    private String name;

    private Compress(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Compress get(Integer code) {
        for (Compress status : Compress.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }

        return null;
    }

    public boolean equal(int code) {
        return this.code == code;
    }

}
